import os, sys

PREF = "../Jars/"
CLASS_PATH = PREF + "junit.jar;" + PREF + "jeconbond.jar"

buf = open("comp_coll.java").read()
buf = buf[:buf.find("public")].replace("\n", "").replace("import ", "").split(";")[:-1]

CLASSES = buf
del buf

if (not os.path.exists("../_Out/CM/")):
	os.mkdir("../_Out/CM/")

for c in CLASSES:
	cn = c.split(".")
	cn = cn[len(cn) - 1]
	name = "run-" + cn + ".cmd"
	f = open("../_Out/CM/" + name, "w")
	javacm = "javaw"
	if cn.find("JEBAllTests") > -1:
		javacm = "java"
	f.write("start " + javacm + " -cp " + CLASS_PATH + " " + c + " autorun")
	f.close()
	f = open(name, "w")
	f.write("cd ../_Out/CM\ncall " + name)
	f.close()
